import url from "@/url.config";
import {request} from "@api/service";

export default ({service, request, tools}) => ({
    GetfindByTree() {
        // 获取告警类型树
        return request({
            url: url.ip3 + "/waring/type/findByTree",
            method: "get",
        });
    },
    GetfindByPage(data) {
        // 获取告警类型分页数据
        return request({
            url: url.ip3 + "/waring/type/findByPage",
            method: "post",
            data: data,
        });
    },
    // 添加警告类型异常类型名称获取
    // http://47.114.117.125:8601/api/waring/type/findByName/累计百分声计 L90
    WaringTypeFindByName(name) {
        return request({
            url: url.ip3 + `/waring/type/findByName/${name}`,
            method: "post"
        })
    },
    PostfindByTree(data) {
        // 添加告警类型
        return request({
            url: url.ip3 + "/waring/type/save",
            method: "post",
            data: data,
        });
    },
    PuteditTree(data) {
        // 修改告警类型
        return request({
            url: url.ip3 + "/waring/type/edit",
            method: "put",
            data: data,
        });
    },
    // 删除告警类型
    Delwaring(id) {
        return request({
            url: url.ip3 + "/waring/type/remove/" + id,
            method: "delete",
        });
    },
    // 异常类型值接口
    PostabnormalfindByPage(data) {
        return request({
            url: url.ip3 + "/abnormal/findByPage",
            method: "post",
            data: data,
        });
    },
    // 添加异常警告值
    Postabnormalsave(data) {
        return request({
            url: url.ip3 + "/abnormal/save",
            method: "post",
            data: data,
        });
    },
    /**  封印
     Putabnormaledit(data) {
    // 修改异常警告值
    return request({
      url: url.ip3 + "/abnormal/edit",
      method: "put",
      data: data,
    });
  },
     Delabnormalremove(id) {
    // 删除异常警告值
    return request({
      url: url.ip3 + "/abnormal/remove/" + id,
      method: "delete",
    });
  },
     */
    PostabnormalfindByWaringType(id) {
        // 查询出默认警告数值
        return request({
            url: url.ip3 + "/abnormal/findByWaringType/" + id,
            method: "post",
        });
    },
    WaringRecordSelect(data) {
        // 获取警报记录
        return request({
            url: url.ip3 + "/waring/record/select",
            method: "post",
            data: data,
        });
    },
    caodan(id) {
        return request({
            url: "http://10.10.10.42:8601/api/equipment/remove/" + id,
            method: "delete",
        });
    },
    //从库存中查找物资信息
    FindrepairslList(data) {
        return request({
            url: url.ip3 + "/spare/equipment/repairs/list",
            method: "post",
            data: data,
        });
    },
    //保存修理信息
    SaveRepairInfo(data) {
        return request({
            url: url.ip3 + "/spare/save/repair/info",
            method: "post",
            data: data,
        });
    },

    // 监测因子接口
    // 根据监测站点id获取检测因子
    FindByMonitorId(monitorId) {
        return request({
            url: url.ip3 + `/monitorFactors/findByMonitorId/${monitorId}`,
            method: "post"
        })
    },


    getDealInfoList(data) {
        return request({
            url: url.ip3 + "/monitor/error/find/deal/info",
            method: "post",
            data: data,
        });
    },
    addDealInfo(data) {
        return request({
            url: url.ip3 + "/monitor/error/save/replace",
            method: "post",
            data: data,
        });
    },
    getDealInfo(id) {
        return request({
            url: url.ip3 + "/monitor/error/find/replace/" + id,
            method: "get"
        });
    },

    getReplaceInfo(data) {
        return request({
            url: url.ip3 + "/monitor/error/find/replace/info",
            method: "post",
            data: data,
        });
    },
    // 采购物资管理接口
    // 分页查询接口
    sparePartsFindByPage(data) {
        return request({
            url: url.ip3 + "/spare/parts/findByPage",
            method: "post",
            data: data
        })
    },
    // 添加采购物资接口
    sparePartsSave(data) {
        return request({
            url: url.ip3 + "/spare/parts/save",
            method: "post",
            data: data
        })
    },
    // 修改采购物资
    sparePartsUpdateById(data) {
        return request({
            url: url.ip3 + "/spare/parts/updateById",
            method: "post",
            data: data
        })
    },
    // 删除采购物资
    sparePartsRemoveById(id) {
        return request({
            url: url.ip3 + `/spare/parts/removeById/${id}`,
            method: "post"
        })
    }
});
